# -*- coding: utf-8 -*-
import base64
import requests

# www.jfbym.com  注册后登录去用户中心

with open(r'D:\LongGuoOutput\LongGuoWeb\captcha.jpg', 'rb') as f:
    b = base64.b64encode(f.read()).decode()  ## 图片二进制流base64字符串

def verify():
    url = "http://api.jfbym.com/api/YmServer/customApi"
    data = {
        "token": "IlVvGWzgwIY6qecOw9vyEqORxGXQHbZkifodV_3cku8",
        "type": "10110",  # 默认类型
        "image": b,
    }
    _headers = {
        "Content-Type": "application/json"
    }
    response = requests.request("POST", url, headers=_headers, json=data).json()
    print(response)
    print("返回的验证码---->",response['data']['data'])
    return response['data']['data']


if __name__ == '__main__':
    verify()

